/**
 * 
 */
package com.ofek.applicationbase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * @author Ofek
 *
 */
public abstract class BaseAdapter extends android.widget.BaseAdapter {

	protected final Context context;
	protected final LayoutInflater inflater;
	private final int rowLayoutResource;

	/**
	 * 
	 */
	public BaseAdapter(final Context c,final int rowLayoutResource) {
		context = c;
		this.rowLayoutResource = rowLayoutResource;
		inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.widget.Adapter#getView(int, android.view.View,
	 * android.view.ViewGroup)
	 */
	@Override
	public View getView(final int position, View convertView,
			final ViewGroup parent) {
		if (convertView == null) 
			convertView = inflater.inflate(rowLayoutResource, parent, false);
		adjustView(position, convertView);
		return convertView;
	}
	public abstract void adjustView(final int position, final View convertView);

}
